import cache from '@/utils/cache'
import constant from '@/utils/constant'
import service from '@/utils/request'

export const uploadImg = (params: FormData) => {
	return service.postForm(constant.uploadUrl + '?access_token=' + cache.getToken(), params)
}

export const fileDownloadByName = (fileName: string) => {
	return service.get(`/api/files/${fileName}/download`)
}

export const filePreviewByName = (fileName: string) => {
	return service.get(`/api/files/${fileName}/preview`)
}

export const filePreviewById = (fileId: string) => {
	return service.get(`/api/files/${fileId}/previewByFileId`)
}
